package cn.otrue.patienthealthmanager.adapter;

import java.util.List;
import java.util.Map;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.TextView;
import cn.otrue.patienthealthmanager.R;
import cn.otrue.patienthealthmanager.activity.DoctorAuthorityActivity;

public class DoctorAddAdpater extends BaseAdapter {

	private List<Map<String, String>> add;
	private LayoutInflater inflater;
	private Context context;
	private TextView tw_doctor_mingzi;
	private TextView tw_doctor_weizhi;
	private TextView tw_doctor_zhuzhi;
	private CheckBox iv_add_a;

	public DoctorAddAdpater(Context context, List<Map<String, String>> add) {
		super();
		this.add = add;
		this.context = context;
		inflater = LayoutInflater.from(this.context);

	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return add.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		arg1 = inflater.inflate(R.layout.activity_add_fragment_list, null);

		tw_doctor_mingzi = (TextView) arg1.findViewById(R.id.tw_doctor_mingzi);
		tw_doctor_weizhi = (TextView) arg1.findViewById(R.id.tw_doctor_weizhi);
		tw_doctor_zhuzhi = (TextView) arg1.findViewById(R.id.tw_doctor_zhuzhi);
		iv_add_a = (CheckBox) arg1.findViewById(R.id.iv_add_a);
		iv_add_a.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent();
				intent.setClass(context, DoctorAuthorityActivity.class);
				context.startActivity(intent);

			}
		});

		Map<String, String> eachMap = add.get(arg0);
		tw_doctor_mingzi.setText(eachMap.get("one") + "");
		tw_doctor_weizhi.setText(eachMap.get("two") + "");
		tw_doctor_zhuzhi.setText(eachMap.get("shree") + "");

		return arg1;

	}

}
